package com.pjhouse.core.landlord.persistence.impl;

import java.util.HashMap;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.pjhouse.core.common.persistence.IBatisBaseRepository;
import com.pjhouse.core.landlord.domain.LandlordDTO;
import com.pjhouse.core.landlord.persistence.LandlordRepository;

@Repository("landlordRepository")
public class LandlordRepositoryImpl extends IBatisBaseRepository implements LandlordRepository {

	@Override
	public long insert(LandlordDTO landlord) {
		return (Long)super.insert("PJ.LANDLORD.insert", landlord);
	}

	@Override
	public boolean updateStatus(long id, int status){
		Map<String, Object> param = new HashMap<String, Object>();
		param.put("id", id);
		param.put("status", status);
		return super.update("PJ.LANDLORD.updateStatus", param) == 1;
	}

	@Override
	public LandlordDTO queryById(long id) {
		return (LandlordDTO) super.queryForObject("PJ.LANDLORD.findById", id);
	}

}
